using Android.Widget;
using Android.Graphics;
using Android.Content;
using Android.Util;

namespace UnitDriven
{
  public class StatusButton : ImageButton
  {
    Color _statusColor;

    public StatusButton(Context context, IAttributeSet attrs) : base (context, attrs) 
    {
      Init();
    }

    public StatusButton(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)  
    {
      Init();
    }

    public StatusButton(Context context) : base(context)
    {
      Init();
    }

    private void Init()
    {
      this.Focusable = true;
      this.Clickable = true;
      this.SetBackgroundColor(Color.Transparent);
      this.SetScaleType(ScaleType.FitCenter);
    }

    public Color StatusColor
    {
      get { return _statusColor; }
      set { _statusColor = value; }
    }

    protected override void OnDraw(Android.Graphics.Canvas canvas)
    {
      Android.Graphics.Paint _paint = new Android.Graphics.Paint();
      _paint.Color = _statusColor;
      _paint.SetStyle(Android.Graphics.Paint.Style.Fill);
      canvas.DrawCircle(14, 14, 8, _paint);
    }
  }
}